package edu.fourtwelve.util;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Christopher C. Hunt
 */
public enum RequestType {
    //Enum Values
    AUTHENTICATE("AUTH"),
    CREATE("CREA"),
    BALANCE("BALA"),
    DEPOSIT("DEPO"),
    TRANSFER("TRAN"),
    WITHDRAWL("WITD"),
    USER_NAME("USRN"),
    PASSWORD("PASS"),
    PUBLIC_KEY("PUBK"),
    SECRET_KEY("SECK"),
    GET_ACCOUNT_DATA("GACD");
    
    //Static Members
    private static final Map<String, RequestType> lookup = new HashMap<String, RequestType>();
    //Instance Members
    private String type;

    //Static Methods
    static {
        for (RequestType s : EnumSet.allOf(RequestType.class)) {
            lookup.put(s.getType(), s);
        }
    }

    public static RequestType get(String type) {
        return lookup.get(type);
    }

    //Instance Methods
    private RequestType(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }
}
